/**
 * <copyright>
 * </copyright>
 *

 */
package ms.unicorn.language.languagedef.impl;

import ms.unicorn.language.languagedef.LanguagedefPackage;
import ms.unicorn.language.languagedef.ViewDef;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>View Def</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ms.unicorn.language.languagedef.impl.ViewDefImpl#getViewType <em>View Type</em>}</li>
 *   <li>{@link ms.unicorn.language.languagedef.impl.ViewDefImpl#getEditpart <em>Editpart</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ViewDefImpl extends ModuleItemImpl implements ViewDef
{
  /**
   * The default value of the '{@link #getViewType() <em>View Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getViewType()
   * @generated
   * @ordered
   */
  protected static final String VIEW_TYPE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getViewType() <em>View Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getViewType()
   * @generated
   * @ordered
   */
  protected String viewType = VIEW_TYPE_EDEFAULT;

  /**
   * The default value of the '{@link #getEditpart() <em>Editpart</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEditpart()
   * @generated
   * @ordered
   */
  protected static final String EDITPART_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getEditpart() <em>Editpart</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEditpart()
   * @generated
   * @ordered
   */
  protected String editpart = EDITPART_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ViewDefImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return LanguagedefPackage.Literals.VIEW_DEF;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getViewType()
  {
    return viewType;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setViewType(String newViewType)
  {
    String oldViewType = viewType;
    viewType = newViewType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LanguagedefPackage.VIEW_DEF__VIEW_TYPE, oldViewType, viewType));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getEditpart()
  {
    return editpart;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEditpart(String newEditpart)
  {
    String oldEditpart = editpart;
    editpart = newEditpart;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LanguagedefPackage.VIEW_DEF__EDITPART, oldEditpart, editpart));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case LanguagedefPackage.VIEW_DEF__VIEW_TYPE:
        return getViewType();
      case LanguagedefPackage.VIEW_DEF__EDITPART:
        return getEditpart();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case LanguagedefPackage.VIEW_DEF__VIEW_TYPE:
        setViewType((String)newValue);
        return;
      case LanguagedefPackage.VIEW_DEF__EDITPART:
        setEditpart((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case LanguagedefPackage.VIEW_DEF__VIEW_TYPE:
        setViewType(VIEW_TYPE_EDEFAULT);
        return;
      case LanguagedefPackage.VIEW_DEF__EDITPART:
        setEditpart(EDITPART_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case LanguagedefPackage.VIEW_DEF__VIEW_TYPE:
        return VIEW_TYPE_EDEFAULT == null ? viewType != null : !VIEW_TYPE_EDEFAULT.equals(viewType);
      case LanguagedefPackage.VIEW_DEF__EDITPART:
        return EDITPART_EDEFAULT == null ? editpart != null : !EDITPART_EDEFAULT.equals(editpart);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (viewType: ");
    result.append(viewType);
    result.append(", editpart: ");
    result.append(editpart);
    result.append(')');
    return result.toString();
  }

} //ViewDefImpl
